package org.luojs.temp_method;

import java.math.BigDecimal;
import java.util.function.Consumer;
import java.util.function.Supplier;

public class BankBusinessHandler {

    public void save(BigDecimal amount) {
         //execute(a -> System.out.println("save " + amount));
    }

    public void draw(BigDecimal amount) {
        //execute(a -> System.out.println("draw " + amount));
    }

    public void moneyManage(BigDecimal amount) {
        //execute(a -> System.out.println("draw " + amount));
    }

    /**

     * 模板方法

     */

    protected void execute(Supplier<String> supplier, Consumer<BigDecimal> consumer) {

        String number = supplier.get();

        System.out.println(number);


        if (number.startsWith("vip")) {

            //Vip号分配到VIP柜台

            System.out.println("Assign To Vip Counter");

        }

        else if (number.startsWith("reservation")) {

            //预约号分配到专属客户经理

            System.out.println("Assign To Exclusive Customer Manager");

        }else{

            //默认分配到普通柜台

            System.out.println("Assign To Usual Manager");

        }

        consumer.accept(null);

        //judge();

    }
}
